#!/bin/sh /etc/rc.common

START=90
STOP=10
USE_PROCD=1
PROG=/bin/idc_mesh

#校验参数的函数
validate_idc_mesh_section() {
         uci_validate_section idc_mesh conf "${1}" \
                'ipaddr:string' \
                'username:string' \
                'password:string'
}
#启动函数
start_service() {
        local ipaddr username password
        #启动可执行服务程序
        validate_idc_mesh_section mesh || {
                echo "validation failed"
                return 1
        }
        echo $ipaddr
        echo $username
        echo $password
        procd_open_instance
        procd_set_param command $PROG
        procd_set_param respawn
        procd_set_param stderr 1
        procd_set_param stdout 1
        procd_close_instance
}
#停止函数
stop_service()
{
        service_stop ${PROG}
}

#服务触发函数
service_triggers()
{
        procd_add_reload_trigger "idc_mesh"
        procd_add_validation validate_idc_mesh_section
}